package com.misweb.ibase;

import org.springframework.http.HttpRequest;
import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.ClientHttpResponse;

import java.io.IOException;
import java.util.List;

public class HttpBasicInterceptor4Laowugongren implements ClientHttpRequestInterceptor {
    @Override
    public ClientHttpResponse intercept(HttpRequest request, byte[] data, ClientHttpRequestExecution execution) throws IOException {
        // do something  发送之前添加cookie
        if(request.getHeaders().containsKey("Cookie")){
            //do nothing

        }else{
            if(GlobalData.getCookieString()!=null){
                request.getHeaders().add("Cookie", GlobalData.getLaowugongrenCookieString());

            }
        }



        ClientHttpResponse temp= execution.execute(request, data);

        return temp;
    }



}

